<template>
	<view class="pages">
		<!-- 代码 start -->
		<view class="header">
			<view class="search" style="display: flex;align-items: center;">
				<u--input
					    placeholder="输入关键字搜索"
						v-model="keyWords"
					    prefixIcon="search"
					    prefixIconStyle="font-size: 22px;color: #909399"
						focus
						shape="circle"
						border="none"
					></u--input>
			</view>
			<view class="searchBtn"  @click="keyWordSearch()">搜索</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				tissueCount: [],
				filterText: '',
				newarr: [],
				keyWords:'',
			}
		},
		onLoad() {
			
		},
		methods: {
			keyWordSearch(){
				uni.request({
					url: 'https://restapi.amap.com/v3/geocode/geo?parameters',
					method: 'GET',
					type: 'gcj02',
					data: {
						key: '44237e1964e1480718c9efbe5d214bed', //高德地图key
						address:this.keyWords  // 详细地址
					},
					success: res => {
						// console.log(res.data.geocodes[0].location)
						const latitude = res.data.geocodes[0].location.split(",")[0];
						const longitude = res.data.geocodes[0].location.split(",")[1];
						let data = {
							la: latitude,
							lo: longitude,
							name:this.keyWords
						}
						uni.setStorageSync('cityInfo',data)
						uni.redirectTo({
							url:"/pages/my/organization/location"
						})
					}
				})
			}
		}
	}
</script>




<style lang="scss" scoped>
	.header {
		padding: 0 20rpx;
		background-color: #ffffff;
		height: 100rpx;
		display: flex;
		margin: 0 auto;
		justify-content: space-between;
		.left{
			display: flex;
			line-height: 100rpx;
			.city{
				font-size: 32rpx;
				font-weight: 500;
				color: #242424;
			}
			.icon{
				margin-left: 10rpx;
				display: flex;
				justify-content: center;
				align-items: center;
			}
		}
		.searchBtn{
			font-size: 28rpx;
			font-weight: 500;
			color: #242424;
			line-height: 100rpx;
			padding-right: 24rpx;
		}
	}
</style>